#唐门优测
#道长最帅666
""
"""
@pytest.mark.usefixtures是pytest调用fixture的方法之一，与直接传入fixture不同的是，它无法获取
到被fixture装饰的函数的返回值
使用场景是被测试函数需要多个fixture做前后置工作时使用

"""
"传入单个fixture"
# import pytest
# @pytest.fixture()
# def one_2152():
#     print("我是一个fixture函数")
#
# @pytest.mark.usefixtures('one_2152')
# def test_one_fixture():
#     print("测试用例1")
#     assert 1 == 1

"传入多个fixture,会按先后执行"
# import pytest
# @pytest.fixture()
# def one_2152():
#     print("我是一个one_2152fixture函数")
#
# @pytest.fixture()
# def two_2152():
#     print("我是一个two_2152fixture函数")
#
# @pytest.mark.usefixtures('one_2152','two_2152')
# def test_one_fixture():
#     print("测试用例1")
#     assert 1 == 1

"叠加使用多个fixture，从下至上离测试函数越近的先执行"
import pytest
@pytest.fixture()
def one_2152():
    print("我是一个one_2152fixture函数")

@pytest.fixture()
def two_2152():
    print("我是一个two_2152fixture函数")

@pytest.mark.usefixtures('one_2152')
@pytest.mark.usefixtures('two_2152')
def test_one_fixture():
    print("测试用例1")
    assert 1 == 1

"总结"
"""
1，单个fixture：在被测试函数之前执行
2，多个fixture：按传值先后顺序执行
3，叠加fixture：自下至上执行，离测试函数越近的先被执行
"""